package JavaBase;
/*
*以(OO)面向对象的思想，编写自定义类描述图书(Book)信息。设定属性包括：
*书名(title)，作者(author)，出版社名称(publisher)，价格(price)；方法包括介绍
*要求: a)、图书信息介绍方法描述图书所有信息;b)编写测试类，测试图书类的对象及相关方法(测试数据信息自定)
 */
public class Book {
    private String title;
    private String author;
    private String publisher;
    private double price;
    public Book()
    {
        this.title="未知";
        this.author="未知";
        this.publisher="未知";
        this.price=100;
    }
    public Book(String title,String author,String publisher,double price)
    {
        this.title=title;
        this.author=author;
        this.publisher=publisher;
        this.price=price;
    }

    public void setPrice(double price) {
        this.price = price;
    }

    public double getPrice() {
        return price;
    }

    public String getAuthor() {
        return author;
    }

    public String getPublisher() {
        return publisher;
    }

    public void setAuthor(String author) {
        this.author = author;
    }

    public String getTitle() {
        return title;
    }

    public void setPublisher(String publisher) {
        this.publisher = publisher;
    }

    public void setTitle(String title) {
        this.title = title;
    }
    public void showBook()
    {
        System.out.println("***图书介绍***");
        System.out.println("图书名："+this.title);
        System.out.println("作者："+this.author);
        System.out.println("出版社名称："+this.publisher);
        System.out.println("价格："+this.price);
    }
}
